import request from "@/utils/request";
/* 封装登录login函数 */
export const loginForm = (obj) => {
  return request({
    url: "/api/login",
    method: "post",
    data: obj,
  });
};
/* 封装注册函数 */
export const regForm = (obj) => {
  return request({
    url: "/api/reg",
    method: "post",
    data: obj,
  });
};
/* 获取用户信息函数 */
export const getUserInfoApi = () => {
  return request({
    url: "/my/userinfo",
    method: "get",
  });
};

/* 修改用户信息函数 */
export const updateUserInfoApi = (obj) => {
  return request({
    url: "/my/userinfo",
    method: "put",
    data: obj,
  });
};

/* 修改密码函数 */
export const updatePwdApi = (obj) => {
  return request({
    url: "/my/updatepwd",
    method: "PATCH",
    data: obj,
  });
};

/* 修改密码函数 */
export const avatarApi = (avatar) => {
  return request({
    url: "/my/update/avatar",
    method: "PATCH",
    data: {
      avatar: avatar,
    },
  });
};
